package com.jthinking.service.kafka.delay.queue.web.controller;

import com.jthinking.service.kafka.delay.queue.storage.StorageService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/task")
public class TaskController {

    @Resource
    private StorageService storageService;

    @RequestMapping("/add")
    public String add(Long second, String value) {
        if (second == null || second < 1 || value == null) {
            return "error";
        }
        storageService.add(second, value.getBytes());
        return "ok";
    }

    @RequestMapping("/list")
    public String get(Long startSecond, Long endSecond) {

        return "ok";
    }

}
